(function(){
	var arry = [1,2,3,4,5,6,7,8,9,10,11,12,13,14,15];
 	// console.log(arry.lastIndexOf(8, -1));
	
	
	var ret = {};
	
	function each(object, callback){
		if(undefined === object.length){
			for(var name in object){
				if(false === 
					callback(object[name], name, object)) // ---> flag-1. object not use
					break;
			}
		} else{
			for(var i=0, len = object.length; i<len; i++){
			    if(i in object){
					if(false === 
						callback(object[i], i, object)) 
						break;
				}
			}
		}
	}
	
	each({
		forEach: function(object, callback, thisp){
			each(object, function(){
				callback.apply(thisp, arguments);
			});
		},
		map: function(object, callback, thisp){
			var ret = [];
			each(object, function(){
				ret.push(callback.apply(thisp, arguments));
			});
			return ret;
		}
	}, 

	function(method, name){ //callback --- flag-1
		ret[name] = function(object, callback, thisp){
			if(object[name]){
				return object[name](callback, thisp);
			}else{
				return method(object, callback, thisp);
			}
		}
	});
	/**
		callback --- each
		ret.forEach = function(object, callback, thisp){
			if(object.forEach){
	l			return object.forEach(callback, thiso);
			}else{
				return function(object, callback, thisp){
					each(object, function(){
						callback.apply(thisp, arguments);
					});
				}
			}
		}
	*/
	
	// var tt = [1,2,3,4,5];
	// var objectContext = {
		// name : 'thisp'
	// };
	// ret.forEach(tt, function(i, v){
		// alert(this)
	// }, objectContext);
	// Array.prototype.forEach.call(tt, function(value, key){
		// console.log(this)
	// }, objectContext);
	
	
	
	var ImageTrans = function(opts, numb){
		this._initialize(opts, numb);
	};
	
	ImageTrans.prototype = {
		
		_initialize : function(opts, numb){
			console.log(numb);
			console.log(opts);
		}
	};
	
	ImageTrans.prototype._initialize = (function(){
		
		var init = ImageTrans.prototype._initialize;
		
		function start(){
			console.log('start---1');
		};
		
		return function(){
			start();
			var opts = arguments[0];
			opts.test = 23;
			var numb = arguments[1] = 12;
			// numb = 12;
			init.apply(this, Array.prototype.slice.apply(arguments));
		}
	})();
	
	ImageTrans.prototype._initialize = (function(){
		
		var init = ImageTrans.prototype._initialize;
		
		function start(){
			console.log('start---2');
		};
		
		return function(){
			console.log(arguments[0]);
			// numb = 12;
			init.apply(this, Array.prototype.slice.apply(arguments));
		}
	})();
	
	new ImageTrans({
		a : 1,
		b : 2
	}, 11);
			
	// var it = new ImageTrans();
})();